<?php
/**
 * PHP Class
 *
 * LICENSE
 *
 * Processing: store single module
 *
 * @category   	Joomzf Module Module
 * @package    	Module
 * @copyright  	Copyright vinanewstar.vn@gmail.com
 * @author		GiangNam (vinanewstar.vn@gmail.com)
 * @license    	GNU General Public License Version 2 or later (the "GPL")
 * @version     v1.0 May 20, 2012 - 5:39:02 PM
 */
class Joomzf_Modules_Module{
	
	public $id;
	public $name;
	public $position;
	public $publish_up;
	public $publish_down;
	public $access;
	public $published;
	public $params;
	public $order;
	public $showTitle;
	public $description;
	public $area;
	
	public $content;
	
	/**
	 * load from db depend on conditions in $option
	 * @param String | Array $option
	 */
	public function __construct($id = null){
		$db = Zend_Registry::get("DBO");
		$sql = $db->select()
		        ->from(TBL_PRF."modules",array('id','name','position','publish_up','publish_down','access','published','params','order','show_title','description','area'))
				->where("id = ?",$id);
		$module = $db->fetchRow($sql);
		
		$this->id 				= $module['id'];
		$this->name 			= $module['name'];
		$this->position 		= $module['position'];
		$this->access 			= $module['access'];
		$this->publish_up 		= $module['publish_up'];
		$this->publish_down 	= $module['publish_down'];
		$this->access 			= $module['access'];
		$this->params 			= ($module['params'] =="") ? "" : json_decode($module['params']);
		$this->order 			= $module['order'];
		$this->show_title 		= $module['show_title'];
		$this->description 		= $module['description'];
		$this->area 			= $module['area'];
	}
}